<template>
  <div class="app-container" ref="content">
    <div style="text-align: center;padding: 10px">《{{ recordsInfo.enterpriseName }}》-详情信息</div>
      <div style="margin: 10px auto;text-align: center">
          <el-button type="primary" size="mini"  @click="toSource" align="center">考核缘由</el-button>
      </div>
    <div style="width: 50%;margin:0px auto;vertical-align:middle;height:100%">
      <el-form :model="recordsInfo" ref="recordsInfo" label-width="150px">
          <el-form-item label="责任企业:" prop="enterpriseId">
            {{ recordsInfo.enterpriseName }}
          </el-form-item>
          <el-form-item label="企业类型:" prop="enterpriseType">
            {{ recordsInfo.enterpriseType | enterpriseType}}
          </el-form-item>
          <el-form-item label="责任人:" prop="executorName">
            {{ recordsInfo.executorName }}
          </el-form-item>
          <el-form-item label="详情:" prop="remark">
            {{ recordsInfo.remark }}
          </el-form-item>
          <el-form-item label="上报时间:" prop="reportTime">
            {{ recordsInfo.reportTime | dateFormat}}
          </el-form-item>
        <el-form-item label="考核类型:" prop="type">
          {{ recordsInfo.type | assessmentType}}
        </el-form-item>
          <el-form-item label="来源类型:" prop="type">
              {{ recordsInfo.source | checkRecordType}}
          </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import {getInCheckRecordsVo} from "@/api/maintenanceCheckRecords";

export default {
  name: "recordsInfo",
  data() {
    return {

      recordsInfo: {},

    }
  },
  created() {
    this.$nextTick(() => {
      this.getInCheckRecordsVo(this.$route.query.ucId)

    });
  },
  methods: {
      toSource(){
          switch (this.recordsInfo.source){
              case  0:
                  this.$router.push("/nonEmergency/hiddenDangerInfo?ucId=" + this.recordsInfo.sourceId)
                  break;
              case  2:
                  this.$router.push("/workOrder/maintenanceInfo?ucId=" + this.recordsInfo.sourceId)
                  break;
              case  3:
                  this.$router.push("/maintenance/maintenanceTaskInfo?ucId=" + this.recordsInfo.sourceId+"&qyId="+this.recordsInfo.enterpriseId)
                  break;
              case  4:
                  this.$router.push("/taskManage/task/info?ucId=" + this.recordsInfo.sourceId)
                  break;
              default :
                  break;
          }

      },
    getInCheckRecordsVo(val) {
      let loadingInstance = this.$loading({
        target: this.$refs.content,
        text: '数据加载中'
      });
      getInCheckRecordsVo({ucId: val}).then(res => {
        console.log(res)
        this.recordsInfo = res.data
        loadingInstance.close()
        this.$notify.success({
          title: '成功',
          message: "获取维保考核记录成功"
        })

      }).catch(error => {
        console.log(error)
        loadingInstance.close()
        this.$notify.error({
          title: '失败',
          message: "获取用户信息失败"
        })
      })
    },


  }

}
</script>

<style>

</style>